Add Date Table
1. From the ribbon, click “Modeling” => ”New
Table”
2. Copy the following DAX and paste it in the formula
bar
Date =
ADDCOLUMNS (
CALENDAR (Min(PoliceInvolvedFatalities[Date]),
MAX(PoliceInvolvedFatalities[Date])),
"DateAsInteger", FORMAT ( [Date], "YYYYMMDD"
),
"Year", YEAR ( [Date] ),
"Monthnumber", FORMAT ( [Date], "MM" ),
"YearMonthnumber", FORMAT ( [Date], "YYYY/MM"
),
"YearMonthShort", FORMAT ( [Date], "YYYY/mmm"
),
"MonthNameShort", FORMAT ( [Date], "mmm" ),
"MonthNameLong", FORMAT ( [Date], "mmmm" ),
"DayOfWeekNumber", WEEKDAY ( [Date] ),
"DayOfWeek", FORMAT ( [Date], "dddd" ),
"DayOfWeekShort", FORMAT ( [Date], "ddd" ),
"Quarter", "Q" & FORMAT ( [Date],
"Q" ),
"YearQuarter", FORMAT ( [Date], "YYYY" ) &
"/Q" & FORMAT ( [Date], "Q" )
)
3. After the date table is created, click the
model tab and create relationship between the new “date” table and
“PoliceInvolvedFatalities” table
4. Mark the new table as a date table